package com.flyme.module.base.client.api;


import com.flyme.common.core.model.ResultBody;
import com.flyme.common.core.model.query.PagerInfo;
import com.flyme.common.core.model.query.PqGrid;
import com.flyme.module.base.client.entity.SystemMenu;
import org.springframework.web.bind.annotation.*;

import java.math.BigDecimal;

public interface SysMenuRemoteService {
    /**
     * 获取菜单资源列表
     *
     * @return
     */
    @PostMapping("/menu")
    PqGrid menu(@RequestParam(value = "pagerInfo") PagerInfo pagerInfo, @RequestParam(name = "keyword", required = false) String keyword);


    /**
     * 获取菜单资源
     *
     * @param menuId menuId
     * @return
     */
    @GetMapping("/menu/{menuId}")
    ResultBody getMenu(@PathVariable("menuId") Long menuId);

    /**
     * 添加菜单资源
     *
     * @param menu
     * @return
     */
    @PostMapping("/menu/add")
    ResultBody addMenu(@RequestBody SystemMenu menu);

    /**
     * 编辑菜单资源
     *
     * @param name     菜单编码
     * @param title    菜单名称
     * @param icon     图标
     * @param prefix   请求前缀
     * @param path     请求路径
     * @param target   打开方式
     * @param status   是否启用
     * @param parentId 父节点ID
     * @param priority 优先级越小越靠前
     * @param menuDesc 描述
     * @return
     */
    @PostMapping("/menu/update")
    ResultBody updateMenu(@RequestParam("menuId") Long menuId, @RequestParam(value = "name") String name, @RequestParam(value = "title") String title, @RequestParam(value = "icon", required = false) String icon, @RequestParam(value = "prefix", required = false, defaultValue = "/") String prefix, @RequestParam(value = "path", required = false, defaultValue = "") String path, @RequestParam(value = "target", required = false, defaultValue = "_self") String target, @RequestParam(value = "status", defaultValue = "1") Integer status, @RequestParam(value = "parentId", required = false, defaultValue = "0") Long parentId, @RequestParam(value = "priority", required = false, defaultValue = "0") BigDecimal priority, @RequestParam(value = "menuDesc", required = false, defaultValue = "") String menuDesc);

    /**
     * 更新状态
     *
     * @param menuId 菜单ID
     * @param status 状态
     * @return
     */
    @PostMapping("/menu/update/status")
    ResultBody updateStatus(@RequestParam("menuId") Long menuId, @RequestParam(value = "status", defaultValue = "1") Integer status);


    /**
     * 移除菜单
     *
     * @param menuId 菜单ID
     * @return
     */
    @PostMapping("/menu/remove")
    ResultBody removeMenu(@RequestParam("menuId") Long menuId);
    /**
     * 获取用户权限
     * @return
     */
    @GetMapping("/menu/selectMenuByUserId")
    ResultBody selectMenuByUserId();

    /**
     * 获取全部菜单
     * @return
     */
    @GetMapping("/menu/selectAllMenu")
    ResultBody selectAllMenu(@RequestParam("roleCode") Long roleId);

}
